package com.atguigu.biliplayer.fragments;

import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.atguigu.biliplayer.R;

/**
 * 番剧界面的Fragment
 * Created by 刘晨龙 on 2015/11/5.
 */
public class OperaFragment extends BaseFragment{

    private SwipeRefreshLayout mSwipeRefreshLayout;

    @Override
    protected View initView() {
        TextView textView = new TextView(getActivity());
        textView.setText("番剧");
        textView.setTextSize(40);
        mSwipeRefreshLayout = (SwipeRefreshLayout) View.inflate(mContext, R.layout.fragment_opera, null);
        mSwipeRefreshLayout.addView(textView);
        //设置卷内的颜色
        mSwipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
                android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light);
        //设置下拉刷新监听
        mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                new Handler().postDelayed(new Runnable() {

                    @Override
                    public void run() {
                        Log.i("OperaFragment", "run: " + "成功");
                    }
                }, 2000);
            }
        });

        return mSwipeRefreshLayout;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
    }

}
